package com.chenbei.system.domain;

import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chenbei.common.domain.BaseEntity;
import com.chenbei.system.converter.UserStatusConverter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "用户实体类")
@TableName("user")
//忽略未注解ExcelProperty的字段进行读写操作
@ExcelIgnoreUnannotated
//统一列的默认宽度
@ColumnWidth(15)
//设置表头的高度
@HeadRowHeight(30)
public class User extends BaseEntity {

    @Schema(description = "主键ID")
    @TableId(type = IdType.ASSIGN_ID)
    @ExcelProperty(value = "用户ID")
    private Long id;

    @Schema(description = "用户名")
    @TableField("username")
    @ExcelProperty(value = "用户名")
    private String username;

    @Schema(description = "性别")
    @TableField("sex")
    @ExcelProperty(value = "性别")
    private Integer sex;

    @Schema(description = "手机号")
    @TableField("phone")
    @ExcelProperty(value = "手机号")
    private String phone;

    @Schema(description = "邮箱")
    @TableField("email")
    @ExcelProperty("邮箱")
    private String email;

    @Schema(description = "密码")
    @TableField("password")
    private String password;

    @Schema(description = "省份")
    @TableField("province")
    @ExcelProperty("省份")
    private String province;

    @Schema(description = "城市")
    @TableField("city")
    @ExcelProperty("城市")
    private String city;

    @Schema(description = "头像")
    @TableField("avatar")
    private String avatar;

    @Schema(description = "状态")
    @TableField("status")
    @ExcelProperty(value = "状态", converter = UserStatusConverter.class)
    private Integer status;
}
